package Month07.day25;

import java.util.Iterator;
import java.util.LinkedList;

public class DemoLinkedList {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();
        list.add("a");
        list.add("b");
        list.add("c");
//        Iterator<String> iterator = list.iterator();
//        while (iterator.hasNext()){
//            String s=iterator.next();
//            System.out.println(s);
//        }
        list.addFirst("s");
        list.addLast("z");
        String first = list.getFirst();
//        System.out.println(first);
        String last = list.getLast();
        System.out.println(last);
        String s = list.removeFirst();
        String s1 = list.removeLast();
        System.out.println(s);
        System.out.println(s1);
        System.out.println(list);
    }
}
